<?php
if($com->Id > 0)
{
	$buttons[0]['title'] = ucfirst($txt->getWord('proceed_to_checkout').' ');
	$buttons[0]['href'] = '/c/'.($com->getComId()+1).'/';
	$buttons[0]['onclick'] = '';
	$buttons[0]['params']['class'] = 'btn '.$shop->getSetting('checkout_btn_class');
	$buttons[0]['params']['icon'] = $theme->getIconSetPrefix().'-credit-card';
	$buttons[0]['params']['iconR'] = $theme->getIconSetPrefix().'-chevron-right';
	
	$com->setButtonsHeader($buttons);
	unset($buttons);
	
	$buttons[0]['title'] = ucfirst($txt->getWord('continue_shopping'));
	$buttons[0]['href'] = '/';
	$buttons[0]['onclick'] = '';
	$buttons[0]['params']['icon'] = $theme->getIconSetPrefix().'-chevron-left';
	
	$buttons[1]['title'] = ucfirst($txt->getWord('proceed_to_checkout').' ');
	$buttons[1]['href'] = '/c/'.($com->getComId()+1).'/';
	$buttons[1]['onclick'] = '';
	$buttons[1]['params']['class'] = 'btn '.$shop->getSetting('checkout_btn_class');
	$buttons[1]['params']['icon'] = $theme->getIconSetPrefix().'-credit-card';
	$buttons[1]['params']['iconR'] = $theme->getIconSetPrefix().'-chevron-right';
	
	$com->setButtonsFooter($buttons);
	unset($buttons);
	if(UNIVERSAL_ANALYTICS)
	{ $katana->addAnalyticsTrack(" ga('send', 'pageview', '/cart']); "); }
	else
	{ $katana->addAnalyticsTrack("_gaq.push(['_trackPageview', '/cart']);"); }
?>
<?php require(COMPONENTS_PATH.'common/com_top.php'); ?>
<?php 
$items = $cart->getCartItems(); 
?><br />
    <form id="cart_edit" name="cart_edit" method="post" action="">
	<table align="left" cellpadding="0" cellspacing="0" border="0" width="100%" class="zebra table table-condensed table-striped">
    	<thead>
        	<tr>
                <th class="text-left"><?php echo ucfirst($txt->getWord('product_description')); ?><br /></th>
                <th class="text-right"><?php echo ucfirst($txt->getWord('price')); ?><br /></th>
                <th class="text-right"><?php echo $txt->getWord('vat'); ?><br /></th>
                <th class="text-right"><?php echo ucfirst($txt->getWord('count')); ?><br /></th>
                <th>&nbsp;<br /></th>
                <th class="text-right"><?php echo ucfirst($txt->getWord('total')); ?><br /></th>
                <th>&nbsp;<br /></th>
                <?php if($shop->getGlobalSetting('use_dim_shipping_calculation')): ?>
                <th class="text-right"><?php echo ucfirst($txt->getWord('weight')); ?><br /></th>
                <th class="text-right"><?php echo ucfirst($txt->getWord('volume')); ?><br /></th>
                <?php endif; ?>
                <th class="text-center"><?php echo ucfirst($txt->getWord('delete')); ?><br /></th>
            </tr>
        </thead>
        <tbody>
    	<?php 
		if($items)
		{
			foreach($items as $item)
			{
				$bryllupskake = false;
				if(($shop->getSiteId() == 20) && (($item->getProductId() == 31) || ($item->getProductId() == 32) || (($item->getProductId() > 17) && ($item->getProductId() < 24))))
				{ $bryllupskake = true; }
				?>
				<tr>
                    <td class="text-left">
                    	<input name="cart_item[]" value="<?php echo $item->getId(); ?>" type="hidden" />
                        <a href="/p/<?php echo $item->getProductId(); ?>"><?php echo $item->getItemTitle(); ?></a>
						<?php if(($item->getItemVarTitle() != '') && ($item->getItemVarTitle() != 'Standard')) echo '&nbsp;&nbsp;'.$item->getItemVarTitle(); ?>
                        <?php echo '<br />'.ucfirst($txt->getWord('product_number')); ?>:<?php echo $item->getItemIdentity(); ?>
                        <?php 
						if($item->getItemText() != '')
						{ echo '<br />'.ucfirst($txt->getWord('text')).': '.$item->getItemText(); }
						if($item->getItemImage() != '')
						{ 
							?>
                            <br />
                            <?php echo ucfirst($txt->getWord('image')); ?> p&aring; kaken <br />
							<a class="fancyBox" href="<?php echo $item->getItemImageUrl(CART_URL, 0) ?>"><img src="<?php echo $item->getItemImageUrl(CART_URL, (count($thumb['CART'])-1)); ?>" /></a>
                            <?php
						}
						?>
						<br />
                    </td>
					<td class="text-right"><?php echo number_format($item->getSingleItemPrice(2),2,',',' '); ?> kr.</td>
					<td class="text-right"><?php echo number_format($item->getSingleItemTax(2),2,',',' '); ?> kr.</td>
                    <?php if(($bryllupskake) || ($shop->getSetting('buy_min'))): ?>
                    <td class="text-right">
                    	<input type="hidden" name="ic[]" value="<?php echo $item->getCount(); ?>" />
                    	<input class="form-control" disabled="disabled" class="number" size="2" maxlength="4" type="text" name="ic_shaddow" value="<?php echo $item->getCount(); ?>" />
                    </td>
                    <?php else: ?>
					<td class="text-right">
						<input class="number ic input-mini" size="2" maxlength="4" type="text" name="ic[]" value="<?php echo $item->getCount(); ?>" />
					</td>
                    <?php endif; ?>
                    <td class="text-left">
						<?php if(!$shop->getSetting('buy_min')): ?>
						&nbsp;<a href="#" title="<?php echo ucfirst($txt->getWord('update')); ?>" class="btn btn-default btn-sm"><i class="<?php echo $theme->getIconSetPrefix(); ?>-refresh icon refresh"></i></a>
						<?php endif; ?>
					</td>
					<td class="text-right"><?php echo number_format($item->getTotalItemPriceTotal(1),2,',',' '); ?> kr.</td>
                    <td>&nbsp;</td>
                    <?php if($shop->getGlobalSetting('use_dim_shipping_calculation')): ?>
                    <td class="text-right"><?php echo $item->getTotalItemGrosWeight().'&nbsp;'.$item->getItemWeightUnit(); ?></td>
                    <td class="text-right"><?php echo $item->getTotalItemVolume().'&nbsp;'.$item->getItemDimUnit(); ?>&sup3;</td>
                    <?php endif; ?>
                    <td class="text-center"><?php if(!$bryllupskake): ?>&nbsp;<button class="btn btn-danger btn-sm" name="cart_item_delete" value="0" onclick="deleteCartItem('<?php echo $item->getId(); ?>');"><i class="<?php echo $theme->getIconSetPrefix(); ?>-minus-circle"></i></button>
					<?php endif; ?>
					</td>
				</tr>
				<?php
			}
			?>
        </tbody>
        <tfoot>
        	<tr>
                <td class="text-center first bold">
                	<input id="delete_cart_item" name="dci" type="hidden" value="0" />
                    <input id="com_empty_cart" name="empty_cart" value="0" type="hidden" />
                </td>
                <td class="underline text-right"><?php echo number_format($cart->getAllItemsPrice(2),2,',',' '); ?> kr.</td>
                <td class="underline text-right"><?php echo number_format($cart->getAllItemsVat(2),2,',',' '); ?> kr.</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td class="last underline text-right"><?php echo number_format($cart->getAllItemsTotal(1),2,',',' '); ?> kr.</td>
                <td>&nbsp;</td>
                <?php if($shop->getGlobalSetting('use_dim_shipping_calculation')): ?>
                <td></td>
                <td></td>
                <?php endif; ?>
                <td>&nbsp;</td>
            </tr>
        </tfoot>
         <?php
		}
		?>
	</table><div class="clear"></div>
    </form>
    <script type="text/javascript">
		function deleteCartItem(id)
		{
			$('#delete_cart_item').val(id);
			$('#cart_edit').submit(); 
		}
		
		$('#empty_cart_button').click(function()
		{ 
			$('#com_empty_cart').val(1);
			$('#cart_edit').submit(); 
		});
		
		$('.ic').change(function()
		{ $('#cart_edit').submit(); });
		
		$('.refresh').click(function()
		{ $('#cart_edit').submit(); });
	</script>
<?php require(COMPONENTS_PATH.'common/com_bot.php'); } ?>